package com.jwaoo.chat;

import android.arch.persistence.room.ColumnInfo;
import android.arch.persistence.room.Embedded;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;

import com.jwaoo.chat.attachment.FileAttachment;

import java.io.Serializable;

/**
 * Created by jwaoo on 2017/6/30.
 */
@Entity(tableName = "message")
public class Message implements Serializable{
    @PrimaryKey(autoGenerate = true)
    private int _id;
    private String msg;//消息内容
    private int sessionType;//消息类型
    private String avtar;//头像地址
    private long timestamp;//消息时间搓
    private String nickname;//对方昵称
    private int isRead;//消息是否已读,0已读，1未读
    private int msgtype;//消息类型
    private int direct;//发出去的消息0，接受的消息1
    private int state;//消息状态
    private int friend;
    @Embedded
    private FileAttachment attachment;//附件信息
    private int attachState;//附件接受状态
    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public int getDirect() {
        return direct;
    }

    public void setDirect(int direct) {
        this.direct = direct;
    }

    public int getMsgtype() {
        return msgtype;
    }

    public void setMsgtype(int msgtype) {
        this.msgtype = msgtype;
    }

    public int get_id() {
        return _id;
    }

    public void set_id(int _id) {
        this._id = _id;
    }

    public int getIsRead() {
        return isRead;
    }

    public void setIsRead(int isRead) {
        this.isRead = isRead;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public int getSessionType() {
        return sessionType;
    }

    public void setSessionType(int sessionType) {
        this.sessionType = sessionType;
    }

    public String getAvtar() {
        return avtar;
    }

    public void setAvtar(String avtar) {
        this.avtar = avtar;
    }

    public long getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public boolean isTheSame(Message message){
        if (message.get_id() == this.get_id()) return true;
        return false;
    }

    public FileAttachment getAttachment() {
        return attachment;
    }

    public void setAttachment(FileAttachment attachment) {
        this.attachment = attachment;
    }

    public int getAttachState() {
        return attachState;
    }

    public int getFriend() {
        return friend;
    }

    public void setFriend(int friend) {
        this.friend = friend;
    }

    public void setAttachState(int attachState) {
        this.attachState = attachState;
    }
}
